class BaesPages:

    def __init__(self, driver):
        self.driver = driver
        self.size = driver.get_window_size()
        self.height = self.size["height"]
        self.width = self.size["width"]

    def swipe_left(self):
        """封装swipe，左划"""
        self.driver.swipe(start_x=self.width*0.9,
                          start_y=self.height*0.5,
                          end_x=self.width*0.1,
                          end_y=self.height*0.5)

    def swipe_right(self):
        """封装swipe，右划"""
        self.driver.swipe(start_x=self.width*0.1,
                          start_y=self.height*0.5,
                          end_x=self.width*0.9,
                          end_y=self.height*0.5)

    def swipe_up(self):
        """封装swipe，上划"""
        self.driver.swipe(start_x=self.width*0.5,
                          start_y=self.height*0.1,
                          end_x=self.width*0.5,
                          end_y=self.height*0.9)

    def swipe_down(self):
        """封装swipe，下划"""
        self.driver.swipe(start_x=self.width*0.5,
                          start_y=self.height*0.9,
                          end_x=self.width*0.5,
                          end_y=self.height*0.1)

    def swipe(self, direct='left'):
        """调用swipe"""
        if direct == 'left':
            return self.swipe_left()
        elif direct == 'right':
            return self.swipe_right()
        elif direct == 'up':
            return self.swipe_up()
        elif direct == 'down':
            return self.swipe_down()
        else:
            pass


